package com.archetypus.projectschedule.web.involvements.cmd;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.archetypus.projectschedule.common.dto.involvements.Involvement;
import com.archetypus.projectschedule.common.dto.involvements.InvolvementKey;
import com.archetypus.projectschedule.common.exceptions.ProjectSchedulerException;
import com.archetypus.projectschedule.web.common.cmd.ICommand;
import com.archetypus.projectschedule.web.involvements.bd.IInvolvementBD;
import com.archetypus.projectschedule.web.involvements.bd.InvolvementBD;

public class DeleteInvolvementCmd implements ICommand {

	public void execute(HttpServletRequest request,HttpServletResponse response) throws ProjectSchedulerException {
		int projectId = Integer.parseInt(request.getParameter("project"));
		int activityId = Integer.parseInt(request.getParameter("activity"));
		int responsible = Integer.parseInt(request.getParameter("responsible"));
		
		InvolvementKey involvementKey = new InvolvementKey();
		involvementKey.setActivity(activityId);
		involvementKey.setProject(projectId);
		involvementKey.setResponsible(responsible);
		
		Involvement involvement = new Involvement();
		involvement.setInvolvementKey(involvementKey);
		
		IInvolvementBD involvementBD = new InvolvementBD();
		involvementBD.deleteInvolvement(involvement);
	}

}
